﻿using System;
using System.Collections.Generic;
using System.Text;

namespace homework3
{
    class rectangle : Shape
    {
        private double length;//同上
        public double Length
        {
            get
            {
                return length;
            }
            set
            {
                if (value > 0)
                {
                    length = value;
                }
                else
                {
                    length = 0;
                }
            }
        }
        private double width;
        public double Width
        {
            get
            {
                return width;
            }
            set
            {
                if (value > 0)
                {
                    width = value;
                }
                else
                {
                    width = 0;
                }
            }
        }

        public rectangle(double length, double width)
        {
            Length = length;
            Width = width;
        }

        public override double getArea()
        {
            return length * width;
        }

    }
}
